<?php
declare (strict_types=1);

namespace app\api\controller;

use app\common\model\Account as AccountModel;
use app\common\tool\Result;
use think\Response;

class Account extends Base
{
    public function index($type): Response
    {
        $result = AccountModel::getPageList(['type' => $type, 'uid' => $this->user->id],
            'id,fx,amount,front,after,intro,source,create_time', $this->getPage(), $this->getLimit(), false, ['take']);
        $result['balance'] = $this->user->assets->$type;

        return Result::fastReturn($result);
    }
}